package com.chrray.position.domain;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
import java.util.List;

/**
 * 职位小类表 对象
 *
 * @author wusiwee
 * @email wusiwee@163.com
 * @since 1.0.1 2024-08-07
 */

@Data
@ApiModel(description = "职位小类表")
@TableName("fd_job_subcategory")
public class FdJobSubcategory extends Model<FdJobSubcategory> {
	@ApiModelProperty(value = "主键ID")
	@TableId(type = IdType.AUTO)
	private Long id;

	@ApiModelProperty(value = "职位大类ID")
	private Long categoryId;

	@ApiModelProperty(value = "职位小类名称")
	private String name;

	@ApiModelProperty(value = "是否热门:0-非热门,1-热门")
	private Integer hot;

	@ApiModelProperty(value = "排序")
	private Integer sort;

	@ApiModelProperty(value = "描述")
	private String description;

	@ApiModelProperty(value = "创建时间")
	private Date createdTime;

	@ApiModelProperty(value = "更新时间")
	private Date updatedTime;

	private Integer delFlag;


	public static List<FdJobSubcategory> findByIdIn(List<Long> expectedPosition) {
		LambdaQueryWrapper<FdJobSubcategory> wrapper = new LambdaQueryWrapper<>();
		wrapper.in(FdJobSubcategory::getId, expectedPosition);
		return new FdJobSubcategory().selectList(wrapper);
	}

	public static String findNameById(Long id) {
		LambdaQueryWrapper<FdJobSubcategory> wrapper = new LambdaQueryWrapper<>();
		// 只查询名称
		wrapper.select(FdJobSubcategory::getName);
		wrapper.eq(FdJobSubcategory::getId, id);
		FdJobSubcategory fdJobSubcategory = new FdJobSubcategory().selectOne(wrapper);
		return fdJobSubcategory == null ? null : fdJobSubcategory.getName();
	}


	public static FdJobSubcategory findById(Long id) {
		LambdaQueryWrapper<FdJobSubcategory> wrapper = new LambdaQueryWrapper<>();
		wrapper.eq(FdJobSubcategory::getId, id);
		return new FdJobSubcategory().selectOne(wrapper);
	}
}
